import time

from selenium import webdriver
from selenium.webdriver.common.by import By

# 打开浏览器
driver = webdriver.Chrome()
driver.get("https://www.baidu.com")
# 设置隐式等待
driver.implicitly_wait(10)
# 定位元素
kw = driver.find_element(By.ID, "kw")
print(kw.get_attribute("outerHTML"))
# 退出浏览器
time.sleep(2)
driver.quit()
